CC?=gcc
CXX?=g++

CFLAGS=-Wall -Wextra -O2 -std=c11 `llvm-config --cflags` -Wno-discarded-qualifiers -c
LDFLAGS=`llvm-config --cxxflags --ldflags`

CFILES=src/ast.c src/erupt.c src/lexer.c src/main.c src/parser.c src/token.c \
       src/stack.c
OBJFILES=ast.o erupt.o lexer.o main.o parser.o token.o stack.o

all:
	@mkdir -p bin/
	$(CC) $(CFLAGS) $(CFILES)
	$(CXX) $(OBJFILES) $(LDFLAGS) -o bin/erupt
	@-rm $(OBJFILES)

install:
	cp bin/erupt /usr/bin/

clean:
	@-rm -rf $(OBJFILES) bin/

test:
	@bin/erupt tests/*
